<template>
	<view>
		<scroll-view
		:style="'height:'+height+'px;'"
			class="list-scroll-content " 
			scroll-y
			@scrolltolower="getlist"
		  
		
		>
		<view class="notice-item">
			<view class="content" v-for="item in  list"
         :key="item.id">
				<text class="title">
					身份：{{item.level.owner_level_name}}
				</text>
				<view class="user-info-box">
					<image class="portrait" :src="item.user.avatar"></image>
					<text class="username">
						{{item.user.realname}}
						
					</text>
					<text class="phone">
						{{item.user.phone}}
					</text>
					
				</view>
				
				<view class="bot b-t">
					<text>创建时间</text>
					<text class="more-icon yticon ">{{item.created_at}}</text>
				</view>
			</view>
		</view>
			<uni-load-more :status="loadingType"></uni-load-more>
		</scroll-view>
		
	</view>
</template>

<script>
	import uniIcons from '../../ed-icons/ed-icons.vue'
	import {getOne} from '../../api/publicapi.js'
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	
	export default {
		components: {
		     uniLoadMore
		},
		data() {
			return {
				uniIcons,
				key:[],
				height:0,
				list: [],
				page: 1,
				loadingType:'more'
			}
		},
		onLoad(options) {
			// console.log(options)
			this.key = options.name
			let that =this
			uni.getSystemInfo({
			    success: function (res) {
			        console.log(res)
			            that.height = res.windowHeight
			    
			    }
			});
		},
		onShow(){
			this.getlist()
		},
		methods: {
			getlist(){
				if(this.loadingType === 'loading' || this.loadingType === 'noMore' ){
				    //防止重复加载
				    return;
				}
				let data = {
					'page': this.page,
					'key': this.key
				}
				this.loadingType = 'loading';
				getOne('front/owner/getownertm',data).then(res => {
					// console.log(res.data.data)
					// console.log(res.data.data.data)
					let list = []
					if (data.key === 'indirect') {
					  list = res.data
					} else {
					  list = res.data.data
					}
					if (list !== undefined) {
					    if (list.length > 0) {
							this.page += 1
					    	for (let i = 0; i < list.length; i++) {
					    		this.list.push(list[i])
					    	}
							console.log(this.list)
					    	this.loadingType = 'more'
					    } else {
					    	this.loadingType = 'noMore';
					    }
									
					} else {
					    this.loadingType = 'noMore';
						msg(res.data.message)
					}
				})
				console.log(this.loadingType)
			}
		}
	}
</script>

<style lang='scss'>
	page {
		background-color: #f7f7f7;
		padding-bottom: 30upx;
	}
	.kd{
		background: #dfdfdf;
	}

	.notice-item {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.time {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 80upx;
		padding-top: 10upx;
		font-size: 26upx;
		color: #7d7d7d;
	}
	.user-info-box{
		height: 180upx;
		display:flex;
		align-items:center;
		position:relative;
		z-index: 1;
		
		.portrait{
			width: 130upx;
			height: 130upx;
			border:5upx solid #fff;
			border-radius: 50%;
			background: #dfdfdf;
		}
		.username{
			font-size: $font-lg;
			color: $font-color-dark;
			margin-left: 20upx;
			
		}
		.phone{
				font-size: $font-lg - 6upx;
			color: #909399;
			margin-left: 20upx;
		}
		
		
	}
	.content {
		width: 710upx;
		padding: 0 24upx;
		background-color: #fff;
		border-radius: 4upx;
		margin-top: 10px;
	}

	.title {
		display: flex;
		align-items: center;
		height: 90upx;
		font-size: 32upx;
		color: #303133;
		border-bottom: #C0C4CC 1px solid;
	}

	.img-wrapper {
		width: 100%;
		height: 260upx;
		position: relative;
	}

	.pic {
		display: block;
		width: 100%;
		height: 100%;
		border-radius: 6upx;
	}

	.cover {
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, .5);
		font-size: 36upx;
		color: #fff;
	}

	.introduce {
		display: inline-block;
		padding: 16upx 0;
		font-size: 28upx;
		color: #606266;
		line-height: 38upx;
	}

	.bot {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 80upx;
		font-size: 24upx;
		color: #707070;
		position: relative;
	}

	.more-icon {
		font-size: 32upx;
	}
	
	.load {
		text-align: center;
		padding: 30upx;
		font-size: 30upx;
	}
</style>
